﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Collections.Generic;

/// <summary>
/// Summary description for clsUserAcsessDAL
/// </summary>
public class clsUserAcsessDAL
{
    InstantNaukriDataContextDataContext objInstantNaukriDataContextDataContext = new InstantNaukriDataContextDataContext();
    public clsUserAcsessDAL()
    {
        //
        // TODO: Add constructor logic here
        //
    }
    public List<IN_TB_USER_ACCESS_DENIED> GetAllUserAcsess()
    {
        try
        {
            List<IN_TB_USER_ACCESS_DENIED> objIN_TB_USER_ACCESE = new List<IN_TB_USER_ACCESS_DENIED>();
            objIN_TB_USER_ACCESE = (from obj in objInstantNaukriDataContextDataContext.IN_TB_USER_ACCESS_DENIEDs
                                    select obj).ToList();
            return objIN_TB_USER_ACCESE;
        }
        catch (Exception)
        {

            throw;
        }
    }

    public IN_TB_USER_ACCESS_DENIED GetUserAcsessById(int ID)
    {
        try
        {
            IN_TB_USER_ACCESS_DENIED objIN_TB_USER_ACCESE = new IN_TB_USER_ACCESS_DENIED();
            objIN_TB_USER_ACCESE = (from obj in objInstantNaukriDataContextDataContext.IN_TB_USER_ACCESS_DENIEDs
                                    where obj.ID == ID
                                    select obj).SingleOrDefault();
            return objIN_TB_USER_ACCESE;
        }
        catch (Exception)
        {

            throw;
        }
    }

    public int SaveUserAcsess(IN_TB_USER_ACCESS_DENIED objIN_TB_USER_ACCESE)
    {
        try
        {
            IN_TB_USER_ACCESS_DENIED objIN_TB_USER_ACCESED = new IN_TB_USER_ACCESS_DENIED();
            objIN_TB_USER_ACCESED = (from obj in objInstantNaukriDataContextDataContext.IN_TB_USER_ACCESS_DENIEDs
                                     where obj.ID == objIN_TB_USER_ACCESE.ID
                                     select obj).SingleOrDefault();
            if (objIN_TB_USER_ACCESED != null)
            {
                objIN_TB_USER_ACCESED.ID = objIN_TB_USER_ACCESE.ID;
                objIN_TB_USER_ACCESED.USERID = objIN_TB_USER_ACCESE.USERID;
                objIN_TB_USER_ACCESED.PAGE_ID = objIN_TB_USER_ACCESE.PAGE_ID;
                objIN_TB_USER_ACCESED.CREATED_BY = objIN_TB_USER_ACCESE.CREATED_BY;
                objIN_TB_USER_ACCESED.CREATED_ON = objIN_TB_USER_ACCESE.CREATED_ON;
                objIN_TB_USER_ACCESED.MODIFIED_BY = objIN_TB_USER_ACCESE.MODIFIED_BY;
                objIN_TB_USER_ACCESED.MODIFIED_ON = objIN_TB_USER_ACCESE.MODIFIED_ON;
                objInstantNaukriDataContextDataContext.SubmitChanges();
                return objIN_TB_USER_ACCESED.ID;
            }
            else
            {
                objInstantNaukriDataContextDataContext.IN_TB_USER_ACCESS_DENIEDs.InsertOnSubmit(objIN_TB_USER_ACCESED);
                objInstantNaukriDataContextDataContext.SubmitChanges();
                return objIN_TB_USER_ACCESED.ID;
            }
        }
        catch (Exception)
        {

            throw;
        }
    }
}
